package com.supinfo.food.services;

public class UserServiceProxy implements com.supinfo.food.services.UserService {
  private String _endpoint = null;
  private com.supinfo.food.services.UserService userService = null;
  
  public UserServiceProxy() {
    _initUserServiceProxy();
  }
  
  public UserServiceProxy(String endpoint) {
    _endpoint = endpoint;
    _initUserServiceProxy();
  }
  
  private void _initUserServiceProxy() {
    try {
      userService = (new com.supinfo.food.services.UserServiceServiceLocator()).getUserService();
      if (userService != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)userService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)userService)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (userService != null)
      ((javax.xml.rpc.Stub)userService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public com.supinfo.food.services.UserService getUserService() {
    if (userService == null)
      _initUserServiceProxy();
    return userService;
  }
  
  public com.supinfo.food.entities.User[] getAll() throws java.rmi.RemoteException{
    if (userService == null)
      _initUserServiceProxy();
    return userService.getAll();
  }
  
  public com.supinfo.food.entities.User connexion(java.lang.String login, java.lang.String password) throws java.rmi.RemoteException{
    if (userService == null)
      _initUserServiceProxy();
    return userService.connexion(login, password);
  }
  
  public boolean add(com.supinfo.food.entities.User user) throws java.rmi.RemoteException{
    if (userService == null)
      _initUserServiceProxy();
    return userService.add(user);
  }
  
  public void delete(long id) throws java.rmi.RemoteException{
    if (userService == null)
      _initUserServiceProxy();
    userService.delete(id);
  }
  
  
}